<template>
    <div>
<table>
    <tr>
        <td>名称</td>
        <td><input type="text" v-model="state.pname"></td>
    </tr>
    <tr>
        <td>等级</td>
        <td><input type="text" v-model="state.pdengji"></td>
    </tr>
    <tr>
        <td>方案</td>
        <td><input type="text" v-model="state.pfangan"></td>
    </tr>
    <tr>
        <td>下限</td>
        <td><input type="text" v-model="state.pxiaxian"></td>
    </tr>
    <tr>
        <td>上限</td>
        <td>   <input type="text" v-model="state.pshangxian"></td>
    </tr>
    <tr>
        <td>时间</td>
        <td>
            <input type="date" v-model="state.pdates">
        </td>
    </tr>
    <tr>
        <td>
            <input type="button" value="添加" @click="add">
        </td>
        <td></td>
    </tr>
</table>
    </div>
</template>

<script setup lang="ts">
import { reactive, onMounted,toRefs} from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from 'axios'
const route = useRoute()
const router = useRouter()

const data = reactive({
    state:{
       pname:'',
       pdengji:'',
       pfangan:'',
       pxiaxian:'',
       pshangxian:'',
       pdates:''
    }
})

const {state} = toRefs(data)

const add=()=>{
    axios({
        url:'https://localhost:7022/api/Proper/addProper',
        method:'post',
        data:state.value
    }).then((res)=>{
        console.log(res.data);
        if(res.data.data>0){
            alert('添加成功')
        
        }else{
            alert('添加失败')
        }
    })
}



</script>

<style scoped>

</style>